Skip to content

Escape value in CSS ~= attribute selector matching#319

Closed
netliomax25-code wants to merge 1 commit into
itext:developfrom
netliomax25-code:css-attr-selector-quote-value
Closed

Escape value in CSS ~= attribute selector matching#319
netliomax25-code wants to merge 1 commit into
itext:developfrom
netliomax25-code:css-attr-selector-quote-value

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor
  1. The ~= attribute selector in CssAttributeSelectorItem builds a regex from the selector value, so the value is treated as a pattern instead of a literal word.
  2. The value comes from untrusted CSS in an SVG/HTML document, so metacharacters change matching (for example a.c matches abc) and an unbalanced group such as ( throws an unchecked PatternSyntaxException during style resolution.
  3. Quoted the value with Pattern.quote before building the pattern, so it matches literally per the CSS ~= semantics.

@iText-CI

iText-CI commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@netliomax25-code

Copy link
Copy Markdown
Contributor Author

any update?

@vitali-pr

Copy link
Copy Markdown
Contributor

Hi @netliomax25-code ,

The PR has been reviewed and the work has been planned. But I can't give you any promises on when it's done.

@aapsasha

Copy link
Copy Markdown
Contributor

Hi @netliomax25-code,
pull request was merged. The commit hash is 264f0b9. On top of that commit additional one was added with changes. The commit hash is 898e0d5

@aapsasha aapsasha closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants